<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap-table.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/ionicons.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/dataTables.bootstrap.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/menu.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pop.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-2.2.3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-table.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-table-zh-CN.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/pop.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
<head>
    <title>beshid-management</title>
    <link rel="icon" href="">
    <style>
        .cover {
            position:fixed; top: 0px; right:0px; bottom:0px;filter: alpha(opacity=60); background-color: #777;
            z-index: 10; left: 0px;display:none;
            opacity:0.5; -moz-opacity:0.5;
        }
    </style>
</head>
<body style="overflow: hidden">
<div class="navbar-duomi navbar-static-top" role="navigation" style="width:100%;height: 12%;background: white;">
    <div class="">
        <div class="pfhead">
            <img src="${pageContext.request.contextPath}/images/u323.png" class="vline">
            <%-- <img src="${pageContext.request.contextPath}/images/u321.png" class="pfname">--%>
            <span onclick="signOutModel(event)"><a href="${pageContext.request.contextPath}/logout" class="Sign_out_css">退出</a></span>
            <%--/*logout()*/--%>
            <span style="width:18px;margin-left: 48px;">｜</span>
            <span>欢迎您，<shiro:principal/></span><span id="test"></span>
        </div>
    </div>
</div>
<div style="height:88%">
    <div class="col-md-2" style="background-color: #36648B;height:100%">

        <ul id="main-nav" class="nav nav-tabs nav-stacked" style="border-bottom: 0px;padding-top: 20px;">

            <li class="active">
                <a href="#" class="nav-header collapsed" data-toggle="collapse">
                    <i class="glyphicon glyphicon-th-large"></i>
                    首页
                </a>
            </li>

            <shiro:hasRole name="admin">
                <li class="active">
                    <a id="user" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        用户管理
                    </a>
                </li>
                <%--<li class="active">
                    <a id="jifen" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        用户积分管理
                    </a>
                </li>--%>
                <li class="active">
                    <a onclick="toPage('jifenReq/toJifenSentList')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        积分发放管理
                    </a>
                </li>
                <li class="active">
                    <a onclick="toPage('jifenReq/toJifenRecordList')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        积分记录管理
                    </a>
                </li>
                <li class="active">
                    <a id="appeal" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        审核申诉管理
                    </a>
                </li>
            </shiro:hasRole>
            <shiro:hasRole name="cs">
                <li class="active">
                    <a onclick="toPage('user/redirectUserInfo')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        个人管理
                    </a>
                </li>
                <li class="active">
                    <a onclick="openJifenManagerForUsername()" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        积分管理
                    </a>
                </li>
                <li class="active">
                    <a onclick="toPage('jifen/toJifenAudit')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        积分发放管理
                    </a>
                </li>
                <li class="active">
                    <a onclick="toPage('jifen/toJifenBuy')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        积分购买管理
                    </a>
                </li>
                <li class="active">
                    <a onclick="toPage('appeal/toAudit')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        申诉管理
                    </a>
                </li>
            </shiro:hasRole>
            <shiro:hasRole name="sh">
                <li class="active">
                    <a onclick="toPage('user/redirectUserInfo')" class="nav-header collapsed" data-toggle="collapse">
                        <i class="glyphicon glyphicon-th-large"></i>
                        个人管理
                    </a>
                </li>
            </shiro:hasRole>
        </ul>
    </div>

    <div class="col-md-10" id="date_panel" style="height:100%;">
    </div>

</div>
<!-- 退出操作模态框（Modal） -->
<div class="modal fade" id="signOutModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog delDialog" style="width:220px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="delModalLabel">
                    退出
                </h4>
            </div>
            <div class="modal-body">
                确定退出吗？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消
                </button>
                <button type="button" onclick="logout()" class="btn btn-danger">
                    退出
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<%--popup控件--%>
<div id="pop" class="panel panel-default pop" hidden style=" margin-bottom: 150px;margin-right:500px">
    <div id="popHead" class="popHead">
        <a class="popClose" title="关闭" onclick="closePop()">关闭</a>
        <span></span>
    </div>
    <div class="errorImg"><img src="${pageContext.request.contextPath}/images/error.gif" /></div>
    <div id="popTxt" class="popContext"></div>
</div>
<div class="cover"></div>
</body>
<script type="text/javascript">
    /**
     * listData
     * @type {string}
     * @description 全局变量listData存储的是data_panel包含的html
     * ------------------------------------------------------
     * date
     * @type {string}
     * @description 全局变量date存储的是allData中的日期
     */
    var listData="";var date='';
    $(document).ready(function(){

        //跳转用户列表
        $("#user").click(function(){
            $("#date_panel").val("");
            $.ajax({
                url:"${pageContext.request.contextPath }/browseuser",
                success:function(htmlCode){
                    showContentPanel(htmlCode);
                }
            });
        });
    });

    function backpre(){
        $("#date_panel").html("").html(listData);
    }

    function showContentPanel(htmlCode){
        if(htmlCode.indexOf('meta name="Login-Page"') != -1) {
            window.location.href = htmlCode.redirect;
        } else {
            $("#date_panel").html("").html(htmlCode);
        }
    }

    $(function(){
        onkeydown=function(){
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if(13 == e.keyCode){
                getData();
            }
        }
    });

    $('li').click(function(){
        $('.cover').show();
        $("#date_panel").val("");
        if($(this).text().indexOf('首页') != -1){
            $('.cover').hide();
            return false;
        }
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath }/"+$(this).find('a').attr("id").replace("sys","").replace(/(^|\s+)\w/g,function(s){return s.toLowerCase()})+"/redirectSys",
            success:function(htmlCode){
                listData = htmlCode;
                showContentPanel(htmlCode);
            }
        });
    });

    function isLogin(htmlCode){
        if (htmlCode.indexOf('meta name="Login-Page"') != -1) {
            window.location.href = htmlCode.redirect;
        }
    }

    function openJifenManagerForUsername(username){
        var param={"username":username};
        $('.cover').show();
        $("#date_panel").val("");
        $.ajax({
            type:"post",
            data:param,
            url:"${pageContext.request.contextPath }/jifen/redirectSys",
            success:function(htmlCode){
                listData = htmlCode;
                showContentPanel(htmlCode);
            }
        });
    }

    function toPage(url){
        $('.cover').show();
        $("#date_panel").val("");
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath }/"+url,
            success:function(htmlCode){
                listData = htmlCode;
                showContentPanel(htmlCode);
            }
        });
    }
</script>
</html>